﻿@model CoralNode.MvcClient.Models.AccountAuthorizeModel
@using CoralNode.MvcClient.Contexts
@using CoralNode.MvcClient.Helper;
@using DotNetOpenAuth.OAuth2
@{
    Layout = null;
}
<!doctype html>
<html>
<head>
    <meta charset="utf-8">
    <title>@CoralNodeContext.Current.ManageSite.Slogan-@CoralNodeContext.Current.ManageSite.Name
    </title>
    <link rel="stylesheet" type="text/css" href="/Themes/CoralAdmin/_misc/css/screen.css">
    <link rel="stylesheet" type="text/css" href="/Themes/CoralAdmin/_misc/css/login.css">
    <script src="/Themes/CoralAdmin/_misc/scripts/jquery-1.7.2.min.js"></script>
</head>
<body>
    <div id="wrap">
        <div id="phead">
            <div class="extra">
                <span class="logo"><a href="#" style="background-image:url(@Html.ImageUrl(CoralNodeContext.Current.ManageSite.Logo))">@CoralNodeContext.Current.ManageSite.Name</a></span>
            </div>
        </div>
        <div id="pbody">
            <div class="extra">
                <div class="box_login form_main">
                    <span class="t">用户登录</span>
                   
                    <div class="pl_4 pr_4 pt_4 pb_2-5">
                         <form method="post" action="/m/passport/login">
                        @Html.AntiForgeryToken()
                        @Html.ValidationSummary(true)
                            <h2>
		Authorize
	</h2>
	<div style="background-color: Yellow">
		<b>Warning</b>: Never give your login credentials to another web site or application.
	</div>
	<p>
		The
		<%= Html.Encode(Model.ClientApp) %>
		application is requesting to access the private data in your account here. Is that
		alright with you?
	</p>
	<p>
		<b>Requested access: </b>
		<%= Html.Encode(String.Join(" ", Model.Scope.ToArray())) %>
	</p>
                            <p>
                                If you grant access now, you can revoke it at any time by returning to
                                <%= Html.ActionLink("your account page", "Edit") %>.
                            </p>
                              </form>
	@using (Html.BeginForm("AuthorizeResponse", "OAuth2",FormMethod.Post))
	{
	   @Html.AntiForgeryToken()
	    @Html.Hidden("IsApproved")
	    @Html.Hidden("client_id", Model.AuthorizationRequest.ClientIdentifier)
	    @Html.Hidden("redirect_uri", Model.AuthorizationRequest.Callback)
	    @Html.Hidden("state", Model.AuthorizationRequest.ClientState)
	    @Html.Hidden("scope", OAuthUtilities.JoinScopes(Model.AuthorizationRequest.Scope))
	    @Html.Hidden("response_type", Model.AuthorizationRequest.ResponseType == DotNetOpenAuth.OAuth2.Messages.EndUserAuthorizationResponseType.AccessToken ? "token" : "code")
	    <div style="display: none" id="responseButtonsDiv">
	        <input type="submit" value="Yes" onclick=" document.getElementsByName('IsApproved')[0].value = true; return true; " />
	        <input type="submit" value="No" onclick=" document.getElementsByName('IsApproved')[0].value = false; return true; " />
	    </div>
	    <div id="javascriptDisabled">
	        <b>Javascript appears to be disabled in your browser. </b>This page requires Javascript
	        to be enabled to better protect your security.
	    </div>

	    <script language="javascript" type="text/javascript">
	        //<![CDATA[
	        // we use HTML to hide the action buttons and Javascript to show them
	        // to protect against click-jacking in an iframe whose javascript is disabled.
	        document.getElementById('responseButtonsDiv').style.display = 'block';
	        document.getElementById('javascriptDisabled').style.display = 'none';

	        // Frame busting code (to protect us from being hosted in an iframe).
	        // This protects us from click-jacking.
	        if (document.location !== window.top.location) {
	            window.top.location = document.location;
	        }
	        //]]>
		</script>
    }
                        </div>
                  
                </div>
            </div>
        </div>
    </div>

    <script src="/Themes/CoralAdmin/_misc/scripts/jquery.plugin.js"></script>
    <script src="/Themes/CoralAdmin/_misc/scripts/login.js"></script>
    <script type="text/javascript">
        $(document).ready(function () {
            $('form').submit(function () {
                var $login = $('input[name="autoLogin"]');
                if ($login.attr("checked") != undefined) {
                    $login.val(true);
                } else {
                    $login.val(false);
                }
            });
        })
    </script>
</body>
</html>
